<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
	<%
		request.setAttribute("accessPath", request.getContextPath());
	%>
<head>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="">
	<meta name="author" content="">

	<title>考勤查看</title>

	<!-- Bootstrap Core CSS -->
	<link
	href="${ requestScope['accessPath']}/fontcss/bower_components/bootstrap/dist/css/bootstrap.min.css"
	rel="stylesheet">

	<!-- MetisMenu CSS -->
	<link
	href="${ requestScope['accessPath']}/fontcss/bower_components/metisMenu/dist/metisMenu.min.css"
	rel="stylesheet">

	<!-- DataTables CSS -->
	<link
	href="${ requestScope['accessPath']}/fontcss/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css"
	rel="stylesheet">

	<!-- DataTables Responsive CSS -->

	<!-- Custom CSS -->
	<link
	href="${ requestScope['accessPath']}/fontcss/dist/css/sb-admin-2.css"
	rel="stylesheet">

	<!-- Custom Fonts -->
	<link
	href="${ requestScope['accessPath']}/fontcss/bower_components/font-awesome/css/font-awesome.min.css"
	rel="stylesheet" type="text/css">

	<link href="${ requestScope['accessPath']}/fontcss/css/foundation-datepicker.css" rel="stylesheet" type="text/css">

	<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
	<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
	<!--[if lt IE 9]>
	<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
	<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
	<![endif]-->
	<style type="text/css">
#page-wrapper {
	margin: 0 0 0 0px;
}
</style>
	<style>
ul {
	list-style-type: none;
	margin: 0px 0;
}

ul {
	margin: 0;
}

li {
	display: inline-block;
}

li {
	margin: 0;
}

input.labelauty+label {
	font: 12px "Microsoft Yahei";
}

.table>tbody>tr>td {
	vertical-align: middle;
}
</style>
</head>

	<body
	style="font: 14px/1.5 'Microsoft YaHei', arial, tahoma, \5b8b\4f53, sans-serif;">

		<div id="wrapper">

			<div id="page-wrapper">
				<div class="row">
					<div class="col-lg-12">
						<h1 class="page-header"
						style='font-family: "Arial", "Microsoft YaHei", "黑体", "宋体", sans-serif;'>考勤查看(年)</h1>
					</div>

				</div>

				<div class="row">
					<div class="col-lg-12">
						<div class="panel panel-default">
							<!-- /.panel-heading -->
							<div class="panel-body">
									<form action="${ requestScope['accessPath']}/examine/queryByYear" method="post">
									<div class="row">
										<div class="col-lg-6" style="width: 25%">
										<div class=" form-group input-group" style="width:280px;">
											<span class="input-group-addon">学期:</span>
                                            <select class="form-control" name="semesterId" >
                                            	<option value="">--请选择--</option>
                                                <c:forEach items="${semesterList}" var="v" >
                                                	<c:if test="${ v.id == semesterId }">
                                                		<option value="${v.id}" selected="selected">${v.years}${(v.type == 0 ? "第一学期" : "第二学期")}</option>
                                                		<c:set var="years_type" value="${v.years}${(v.type == 0 ? \"第一学期\" : \"第二学期\")}" />
                                                	</c:if>
                                                	<c:if test="${ v.id != semesterId }">
                                                		<option value="${v.id}" >${v.years} ${(v.type == 0 ? "第一学期" : "第二学期")}</option>
                                                	</c:if>
                                                </c:forEach>
                                            </select>
                                        </div>
                                        </div>
                                        <div class="col-lg-6" style="width: 25%">
	                                     <div class=" form-group input-group" style="width:280px;">
	                                     	<span class="input-group-addon">班级:</span>
                                            <select class="form-control" name="classId" >
                                            	<option value="">--请选择--</option>
                                                <c:forEach items="${classesList}" var="v" >
                                                	<c:if test="${ v.id == classId }">
                                                		<option value="${v.id}" selected="selected">${v.className}</option>
                                                		<c:set var="className" value="${v.className}" />
                                                	</c:if>
                                                	<c:if test="${ v.id != classId }">
                                                		<option value="${v.id}" >${v.className}</option>
                                                	</c:if>
                                                </c:forEach>
                                            </select>
										</div>
										</div>
										<div class="col-lg-6" style="width: 25%" >
										<div class=" form-group input-group" style="width:280px;">
	                                     	<span class="input-group-addon">姓名:</span>
											<input  type="text" class="form-control" name="studentName" value="${studentName }" >
											
										</div>
										</div>
										<div class="col-lg-6" style="width: 25%">
										<div class=" form-group input-group">
											<input type="submit" class="btn btn-default" value="检索"/>
										</div>
										</div>
									</div>
								</form>
								<div class="col-lg-6">
				                    <div class="panel panel-default">
				                        <div class="panel-heading">
				                            	<c:if test="${years_type ne null}">
				                            	${years_type },
				                            	</c:if>
				                            	<c:if test="${className ne null}">
				                            	班级：${className },
				                            	</c:if>
				                            	<c:if test="${studentName ne null && studentName ne ''}">
				                            	搜索名字：${studentName}
				                            	</c:if>
				                            	<c:if test="${semesterId eq null && className eq null && studentName eq null}">
				                            	请选择查询条件
				                            	</c:if>
				                        </div>
				                        <!-- /.panel-heading -->
				                        <div class="panel-body">
					                        <c:if test="${errMsg != null }">
						                        <div class="alert alert-danger alert-dismissable">
					                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
					                                ${errMsg }
					                            </div>
				                            </c:if>
				                            <c:if test="${errMsg eq null }">
				                            <div class="table-responsive">
				                                <table class="table table-hover">
				                                    <thead>
				                                        <tr>
				                                            <th>考核状态</th>
				                                            <th>学号</th>
				                                            <th>姓名</th>
				                                            <th>次数</th>
				                                            <th>详情</th>
				                                        </tr>
				                                    </thead>
				                                    <tbody>
				                                    	<c:set var="count1" value="0" />
				                                    	<c:set var="count2" value="0" />
				                                    	<c:set var="count3" value="0" />
				                                    	<c:if test="${checkinsState1 != null }">
					                                        <tr>
					                                        <!-- rowspan=2 -->
					                                            <td rowspan="${checkinsState1.size() }"><a class="glyphicon glyphicon-link" href="#" data-date="${semesterId }" data-id="" data-state="1" data-class="${classId}">迟到</a></td>
					                                            <c:forEach items="${checkinsState1}" var="v">
					                                            <td>${v.sno }</td>
					                                            <td><a href="${ requestScope['accessPath']}/query/studentInfo?studentid=${v.sno }">${v.name }</a></td>
					                                            <td>${v.count }</td>
					                                            <td><a class="glyphicon glyphicon-link" href="#" data-date="${semesterId }" data-id="${v.sno }" data-state="1" data-class="${v.classid }">查看</a></td>
					                                            <c:set var="count1" value="${count1 + 1 }" />
					                                            </c:forEach>
					                                        </tr>
				                                        </c:if>
				                                        <c:if test="${checkinsState2 != null }">
					                                        <tr>
					                                        <!-- rowspan=2 -->
					                                            <td rowspan="${checkinsState2.size() }"><a href="#" class="glyphicon glyphicon-link" data-date="${semesterId }" data-id="" data-state="2" data-class="${classId}">旷课</a></td>
					                                            <c:forEach items="${checkinsState2}" var="v">
					                                            <td>${v.sno }</td>
					                                            <td><a href="${ requestScope['accessPath']}/query/studentInfo?studentid=${v.sno }">${v.name }</a></td>
					                                            <td>${v.count }</td>
					                                            <td><a class="glyphicon glyphicon-link" href="#" data-date="${semesterId }" data-id="${v.sno }" data-state="2" data-class="${v.classid }">查看</a></td>
					                                            <c:set var="count2" value="${count2 + 1 }" />
					                                            </c:forEach>
					                                        </tr>
				                                        </c:if>
				                                        <c:if test="${checkinsState3 != null }">
					                                        <tr>
					                                        <!-- rowspan=2 -->
					                                            <td rowspan="${checkinsState3.size() }"><a href="#" class="glyphicon glyphicon-link" data-date="${semesterId }" data-id="" data-state="3" data-class="${classId}">请假</a></td>
					                                            <c:forEach items="${checkinsState3}" var="v">
					                                            <td>${v.sno }</td>
					                                            <td><a href="${ requestScope['accessPath']}/query/studentInfo?studentid=${v.sno }">${v.name }</a></td>
					                                            <td>${v.count }</td>
					                                            <td><a class="glyphicon glyphicon-link" href="#" data-date="${semesterId }" data-id="${v.sno }" data-state="3" data-class="${v.classid }">查看</a></td>
					                                            <c:set var="count3" value="${count3 + 1 }" />
					                                            </c:forEach>
					                                        </tr>
				                                        </c:if>
				                                    </tbody>
				                                </table>
				                            </div>
				                            </c:if>
				                            <!-- /.table-responsive -->
				                        </div>
				                        <!-- /.panel-body -->
				                        <c:if test="${count1 ne null || count2 ne null || count3 ne null}">
					                        <div class="panel-footer">
					                            	总计：(迟到：${count1 }, 旷课:${count2 } ,请假:${count3 } )
					                        </div>
				                        </c:if>
				                    </div>
				                    <!-- /.panel -->
				                </div>
				                <!-- rightContent -->
				                <div class="col-lg-6" id="rightMessage" style="display:none;">
				                    
				                    <!-- /.panel -->
				                </div>
								
							</div>
							<!-- /.panel-body -->
						</div>
						<!-- /.panel -->
					</div>
					<!-- /.col-lg-12 -->
				</div>
				<!-- /.row -->

			</div>
			<!-- /#page-wrapper -->

		</div>
		<!-- /#wrapper -->

		<!-- jQuery -->
		<script
			src="${ requestScope['accessPath']}/fontcss/bower_components/jquery/dist/jquery.min.js"></script>

		<!-- Bootstrap Core JavaScript -->
		<script
			src="${ requestScope['accessPath']}/fontcss/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

		<!-- Metis Menu Plugin JavaScript -->
		<script
			src="${ requestScope['accessPath']}/fontcss/bower_components/metisMenu/dist/metisMenu.min.js"></script>

		<!-- DataTables JavaScript -->
		<script
			src="${ requestScope['accessPath']}/fontcss/bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
		<script
			src="${ requestScope['accessPath']}/fontcss/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>

		<!-- Custom Theme JavaScript -->
		<script
			src="${ requestScope['accessPath']}/fontcss/dist/js/sb-admin-2.js"></script>

		<script src="${ requestScope['accessPath']}/fontcss/js/foundation-datepicker.js"></script>

		<script src="${requestScope['accessPath']}/fontcss/js/foundation-datepicker.zh-CN.js"></script>

		<!-- Page-Level Demo Scripts - Tables - Use for reference -->
		<!-- 自定义 -->
		<script src="${ requestScope['accessPath']}/js/common/common.js"></script>
		<script src="${ requestScope['accessPath']}/js/examine/examine.js"></script>
		<script>
  
	$('#time').fdatepicker({
		format: 'yyyy-mm-dd'
	});
	
	$("a.glyphicon-link").click(function(){
		var a = this;
		var url = "/examine/checkStudent";
		var params = "semesterName=${years_type}&semesterId=" + $(a).attr("data-date") + "&sno=" + $(a).attr("data-id") + "&ccstate=" + $(a).attr("data-state") + "&classId=" + $(a).attr("data-class");
		debugger;
		accessMethod(url, params, "POST", "json", "rightMessage");
	});
	
    </script>

</body>

	</html>